package com.rg1906.dao.Impl;

import java.sql.SQLException;
import java.util.List;

import javax.sql.DataSource;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import com.rg1906.entity.PermissionList;
import com.rg1906.utils.DataSourceC3P0ThreadLocal;

public class PermissionListDaoImpl {
	DataSource dataSource = DataSourceC3P0ThreadLocal.getDataSource();
	QueryRunner qr = new QueryRunner(dataSource);
	public List<PermissionList> getPermissionList() throws SQLException {
		String sql="select permissionName,id from t_permission limit 0,11 ";
		return qr.query(sql, new BeanListHandler<>(PermissionList.class));
	}
	public Long getCount() throws SQLException {
		String sql="select count(0) from t_permission";
		return qr.query(sql,new ScalarHandler<>());
		
	}
}
